<script src="__PUBLIC__/vendors/jquery.validation/jquery.validate.min.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/additional-methods.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/messages_zh.min.js"></script>
<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<style type="text/css">
    .notice_tit{
        display: block;clear:both;margin-bottom: 5px;
    }

</style>
<div class="row" style="margin-top: -40px;">
    <div class="col-xs-12">
        <div class="" role="tabpanel" data-example-id="togglable-tabs">
            <ul id="tab_list" class="nav nav-tabs bar_tabs" role="tablist">
                <li role="presentation" class="active">
                    <a href="#tab_content_basic" role="tab" id="tab_basic" data-toggle="tab" aria-expanded="true">
                       基本
                    </a>
                </li>
               <li role="presentation" class="">
                    <a href="#tab_content_stock" role="tab" id="tab_stock" data-toggle="tab" aria-expanded="false">
                        库存/规格
                    </a>
                </li>
                <li role="presentation" class="">
                    <a href="#tab_content_detail" role="tab" id="tab_detail" data-toggle="tab" aria-expanded="false">
                        组图/详情
                    </a>
                </li>
                <li role="presentation" class="">
                    <a href="#tab_content_authority" role="tab" id="tab_authority" data-toggle="tab" aria-expanded="false">
                        购买权限
                    </a>
                </li>
                <li role="presentation" class="">
                    <a href="#tab_content_relative" role="tab" id="tab_relative" data-toggle="tab" aria-expanded="false">
                        相关推荐
                    </a>
                </li>
                <li role="presentation" class="">
                    <a href="#tab_content_recommend" role="tab" id="tab_recommend" data-toggle="tab" aria-expanded="false">
                        热门搭配
                    </a>
                </li>
            </ul>
            <form class="form-horizontal" id="add-form" action="">
                <div id="tab_content_list" class="tab-content">
                    <div role="tabpanel" class="tab-pane fade active in" id="tab_content_basic" aria-labelledby="tab_basic">
                        {include file="goods/edit/basic" /}
                    </div>
                    <div role="tabpanel" class="tab-pane fade" id="tab_content_stock" aria-labelledby="tab_stock">
                        {include file="goods/edit/stock" /}
                    </div>
                    <div role="tabpanel" class="tab-pane fade" id="tab_content_detail" aria-labelledby="tab_detail">
                        {include file="goods/edit/detail" /}
                    </div>
                    <div role="tabpanel" class="tab-pane fade" id="tab_content_authority" aria-labelledby="tab_authority">
                        {include file="goods/edit/authority" /}
                    </div>
                    <div role="tabpanel" class="tab-pane fade" id="tab_content_relative" aria-labelledby="tab_relative">
                        {include file="goods/edit/relative" /}
                    </div>
                    <div role="tabpanel" class="tab-pane fade" id="tab_content_recommend" aria-labelledby="tab_relative">
                        {include file="goods/edit/recommend" /}
                    </div>
                </div>

                <div style="padding-top: 150px;" class="form-group">
                    <div class="col-xs-offset-2 col-xs-3">
                        <button type="submit" class="btn btn-success">
                            编辑商品
                        </button>
                        <button type="button" class="btn btn-default" onclick="returnList()">
                            返回列表
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>

<script>
    function returnList()
    {
        window.parent.location.reload(true);
    }
</script>
<script>
    $(function () {
        $("#add-form").validate({
            rules:
                {
                    tel:
                        {
                            required: true,
                            maxlength: 11,
                            minlength: 11,
                            remote:
                                {
                                    url: "{:url('Utils/isUsedMobile')}",
                                    type: "POST",
                                    dataType: "JSON",
                                    data:
                                        {
                                            uid: ""
                                        }
                                }
                        }
                },
            messages:
                {
                    tel:
                        {
                            required: "必须指定会员手机号！",
                            maxlength: "手机号长度必须为11位！",
                            minlength: "手机号长度必须为11位！",
                            remote: "该手机号已被其他会员使用！"
                        }
                },
            ignore: ".validation-ignore",
            submitHandler: function () {
                ajaxSubmit("add-form", true);
            }
        })
    })
</script>